home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 November: Tool Chest / Dev.CD Nov 98 TC.toast / Tool Chest / Development Kits / MPW etc. / MPW-PR / Interfaces&Libraries / Multiprocessing StdCLib / CIncludes / math.h < prev    next >
Encoding:
C/C++ Source or Header  |  1997-03-06  |  5.3 KB  |  205 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        math.h
  3.  
  4.      Contains:    C Interface to the Macintosh Libraries
  5.  
  6.      Version:    Technology:    StdCLib 3.4
  7.                  Release:    3.6d2
  8.  
  9.      Copyright:    © 1987-1996 by Apple Computer, Inc., all rights reserved.
  10.  
  11.      Bugs?:        If you find a problem with this file, send the file and version
  12.                  information (from above) and the problem description to:
  13.  
  14.                      Internet:    apple.bugs@applelink.apple.com
  15.                      AppleLink:    APPLE.BUGS
  16.  
  17. */
  18.  
  19. #ifndef __MATH_H__
  20. #define __MATH_H__
  21.  
  22. #ifndef __CONDITIONALMACROS__
  23. #include <ConditionalMacros.h>
  24. #endif
  25.  
  26.  
  27. #if PRAGMA_ONCE_SUPPORTED
  28. #pragma once
  29. #endif  /* PRAGMA_ONCE_SUPPORTED */
  30.  
  31. #ifdef __cplusplus
  32. extern "C" {
  33. #endif
  34.  
  35. #if PRAGMA_IMPORT_SUPPORTED
  36. #pragma import on
  37. #endif
  38.  
  39. #if PRAGMA_ALIGN_SUPPORTED
  40. #pragma options align=mac68k
  41. #elif PRAGMA_PACK_SUPPORTED
  42. #pragma pack(push, 2)
  43. #endif
  44.  
  45.  
  46.  
  47.  
  48. /*
  49.     Strictly conforming implementations must have the parameters to these routines
  50.     be double, not long double.  They still get evaluated to long double precision
  51.     on the 68K.  We expect that a lot of this confusion will eventually get settled
  52.     by NCEG and then we will do it the NCEG way.
  53. */
  54.  
  55. #if __STDC__ || GENERATINGPOWERPC
  56. typedef double                             _float_eval;
  57. #else
  58. typedef long double                     _float_eval;
  59. #endif  /* __STDC__ || GENERATINGPOWERPC */
  60.  
  61.  
  62. #define HUGE_VAL __inf()
  63.  
  64. /*
  65.  *    We put underscores on the formal parameter names to reduce name space pollution.
  66.  *    Plum-Hall tests require that we do this:  they have macros called exp, size etc.
  67.  */
  68.  
  69. /*
  70.  *    ANSI routines
  71.  */
  72.  
  73. #if PRAGMA_IMPORT_SUPPORTED
  74. #if defined(__CFM68K__)
  75.     #pragma import off
  76. #endif  /*  defined(__CFM68K__)  */
  77.  
  78. #endif  /* PRAGMA_IMPORT_SUPPORTED */
  79.  
  80.  
  81. extern _float_eval sin(_float_eval _x);
  82. extern _float_eval cos(_float_eval _x);
  83. extern _float_eval tan(_float_eval _x);
  84. extern _float_eval asin(_float_eval _x);
  85. extern _float_eval acos(_float_eval _x);
  86. extern _float_eval atan(_float_eval _x);
  87. extern _float_eval atan2(_float_eval _y, _float_eval _x);
  88. extern _float_eval sinh(_float_eval _x);
  89. extern _float_eval cosh(_float_eval _x);
  90. extern _float_eval tanh(_float_eval _x);
  91. extern _float_eval exp(_float_eval _x);
  92. extern _float_eval log(_float_eval _x);
  93. extern _float_eval log10(_float_eval _x);
  94. extern _float_eval frexp(_float_eval _x, int *_exp);
  95. extern _float_eval ldexp(_float_eval _x, int _n);
  96.  
  97. extern _float_eval modf(_float_eval _x, _float_eval *_ip);
  98.  
  99. extern _float_eval pow(_float_eval _x, _float_eval _y);
  100. extern _float_eval sqrt(_float_eval _x);
  101. extern _float_eval floor(_float_eval _x);
  102. extern _float_eval ceil(_float_eval _x);
  103. extern _float_eval fmod(_float_eval _x, _float_eval _y);
  104. extern _float_eval fabs(_float_eval _x);
  105.  
  106. extern _float_eval __inf(void );
  107.  
  108. #if PRAGMA_IMPORT_SUPPORTED
  109. #if defined(__CFM68K__)
  110.     #pragma import on
  111. #endif  /*  defined(__CFM68K__)  */
  112.  
  113. #endif  /* PRAGMA_IMPORT_SUPPORTED */
  114.  
  115.  
  116. /*
  117.  *  Apple extensions
  118.  */
  119.  
  120. #if defined(__useAppleExts__) || defined(applec) && !defined(__STDC__) || defined(__PPCC__) && !defined(__STDC__)
  121.  
  122. /* note fcvt and ecvt are not multi-thread safe / not re-entrant. */
  123. /* please don't use them. */
  124.  
  125. extern char *ecvt(extended value, int ndigit, int *decpt, int *sign);
  126. extern char *fcvt(extended value, int ndigit, int *decpt, int *sign);
  127.  
  128. /* note fcvt_r and ecvt_r are multi-thread safe / re-entrant              */
  129. /* equivalents to fcvt and ecvt. These function are not available in     */
  130. /* versions    of StdCLib prior to 3.5a1. */
  131.  
  132. extern char *ecvt_r(extended value, int ndigit, int *decpt, int *sign, char *dest);
  133. /* Imported from StdCLib. */
  134. extern char *fcvt_r(extended value, int ndigit, int *decpt, int *sign, char *dest);
  135. /* Imported from StdCLib. */
  136.  
  137. #if PRAGMA_IMPORT_SUPPORTED
  138. #if defined(__CFM68K__)
  139.     #pragma import off
  140. #endif  /*  defined(__CFM68K__)  */
  141.  
  142. #endif  /* PRAGMA_IMPORT_SUPPORTED */
  143.  
  144.  
  145. extern _float_eval hypot(_float_eval _x, _float_eval _y);
  146.  
  147. #if GENERATINGPOWERPC
  148. /*
  149.  *    If you use modf() you must decide which version you mean: modf(),
  150.  *    modff() or modfl().  The usual promotions to long double don't
  151.  *    help here because we're using a pointer.
  152.  *
  153.  *    NOTE:    both modff() and modfl() are not ANSI defined functions;
  154.  *            if you use it, your code may not be portable.
  155.  */
  156.  
  157. extern float modff(float _x, float *_ip);
  158. extern long double modfl(long double _x, long double *_ip);
  159.  
  160. #else
  161. /*
  162.  * For the 68K, these are defined as macros which evaluate to modf(),
  163.  * since for the 68K world there is no difference between modf(), modff(),
  164.  * and modfl().  (Functional implementations are also provided if you are
  165.  * linking with MathLib.o.  If you link with CSANELib.o and Math.o,
  166.  * attempting to use the function instead of the macro will cause link
  167.  * errors as these are not available as functions in the older SANE engine.)
  168.  */
  169.  
  170. extern float modff(float _x, float *_ip);
  171. #define modff(_x,_ip) modf(_x,_ip)
  172. extern long double modfl(long double _x, long double *_ip);
  173. #define modfl(_x,_ip) modf(_x,_ip)
  174.  
  175. #endif  /* GENERATINGPOWERPC */
  176.  
  177.  
  178. #if PRAGMA_IMPORT_SUPPORTED
  179. #if defined(__CFM68K__)
  180.     #pragma import on
  181. #endif  /*  defined(__CFM68K__)  */
  182.  
  183. #endif  /* PRAGMA_IMPORT_SUPPORTED */
  184.  
  185.  
  186. #endif  /*  defined(__useAppleExts__)  || (( defined(applec)  &&  ! defined(__STDC__) ) || ( defined(__PPCC__)  &&  ! defined(__STDC__) )) */
  187.  
  188.  
  189. #if PRAGMA_ALIGN_SUPPORTED
  190. #pragma options align=reset
  191. #elif PRAGMA_PACK_SUPPORTED
  192. #pragma pack(pop)
  193. #endif
  194.  
  195. #if PRAGMA_IMPORT_SUPPORTED
  196. #pragma import off
  197. #endif
  198.  
  199. #ifdef __cplusplus
  200. }
  201. #endif
  202.  
  203. #endif /* __MATH_H__ */
  204.  
  205.